require(["common", "coAjax"], function(jSouper, coAjax) {
	App.set("$Event.bus.change_mobile_phone.get_update_phone_code", function(e, vm) {
		var self = this;
		self.setAttribute("disabled", "disabled");
		coAjax.get(appConfig.bus.update_code, {
			mobile_phone: App.get("$Cache.bus.change_mobile_phone.mobile_phone")
		}, function() {
			alert("success", "短信验证码已经发送，请稍等");
			var _second = 60;
			setTimeout(function _t() {
				App.set("$State.bus.change_mobile_phone.wait_second", _second);
				_second -= 1;
				if (_second > 0) {
					setTimeout(_t, 1000);
				} else {
					self.removeAttribute("disabled");
				}
				return _t;
			}(), 1000)
		}, function(errorCode, jqXHR, errorMsg) {
			alert("error", errorMsg);
			self.removeAttribute("disabled");
		});
	});
	App.set("$Event.bus.change_mobile_phone.update_mobile_phone", function(e, vm) {
		coAjax.put(appConfig.bus.change_mobile_phone, App.get("$Cache.bus.change_mobile_phone"), function(result) {
			App.set("$Cache.bus.change_mobile_phone", {});
			App.set("bus_loginer", result.result);
			alert("success", "手机号码修改成功");
		});
	});
});